{include file="public/head"/}

<div class="container-fluid" id='main'>

    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="alert alert-dismissable alert-info">
                <button type="button" class="close">×</button>
                <p></p>
            </div>
        </div>
    </div>
   
   
    <div class="ntDesktop">
        <div class="ntDesktop-head">{:strtoupper($title)}</div>
        <input type="hidden" id="fun" value="{$fun}">

        <div class="row" style="padding:1em">
            <div class="col-md-1">
                <a href="{:url($last_url)}" class="btn btn-default"><span class="fa fa-warehouse"></span> {$last}  </a>
            </div>
            <div :class="is_edit=='loading'? 'col-md-8' : 'col-md-6'"> 
            	<select class="form-control" v-model="selval" @change="changeContainer">
                    <template v-if="seldata.length > 0">
                        <option value="0" v-if="is_edit=='loading'">{:strtoupper(lang('please_select'))}</option>
                        <option :value="item.id" v-for="(item,index) in seldata" :key="item.id">{{formatUnit(item.id,'id')+'  / '+item.name+' / '+item.ready_time+' / '+formatUnit(item.sum_ctn,'UN')+'CTN / '+formatUnit(item.sum_kgs,'KG')+'KGS / '+formatUnit(item.sum_cbm,'M3')+'CBM / '+formatUnit(item.sum_value,'$')+'CNY /'}}</option>
                    </template>
                    <template v-if="seldata.length == 0">
                        <option value="0" >暂无货柜信息</option>
                    </template>
                </select>
            </div>
            <template v-if="is_edit=='loading'">
            <div class="col-md-2">
                <button class='btn btn-default' @click="save('addLoading')" v-if="auth_ids.indexOf(344) != -1">
                    <span class="fa fa-dolly-flatbed"></span> {:strtoupper(lang('select_content_to_load_into_the_container'))}
                </button>
            </div>
            <div class="col-md-1 text-right">
                <div>
                    <a href="{:url('admin/container/adjust')}" class="btn btn-primary" v-if="auth_ids.indexOf(345) != -1">
                        {:strtoupper(lang('enter_container_adjustment'))} <span class="fa fa-arrow-alt-circle-right"></span></a>
                </div>
            </div>
             </template>
             <template v-else>
                <div class="col-md-1">
                    <button class='btn btn-default'><span class="fa fa-search"></span> 显示货柜内容</button>
                </div>
                <div class="col-md-4 text-right">
                    <div>
                        <button class='btn btn-default' @click="save('editAdjust')" v-if="auth_ids.indexOf(346) != -1">
                            <span class="fa fa-pallet"></span> {:strtoupper(lang('the_selected_content_is_returned_to_the_stock'))}</button>
                        <button class='btn btn-primary' data-toggle="modal" data-target="#toContainer_editModal" @click="contentMove()" v-if="auth_ids.indexOf(347) != -1">
                            <span class="fa fa-dolly-flatbed"></span>{:strtoupper(lang('move_selected_content_to_another_container'))}</button>
                    </div>
                </div>
            </template>
        </div>

        <div class="row" style="padding-top:0px" v-if="is_edit=='loading'">
            <div class="col-md-6"> 
                <ul class="nav nav-tabs">
                    <li class="active" @click="changePort(0)">
                        <a href="#" data-toggle="tab">{:strtoupper(lang('all'))}</a>
                    </li>
                    <li v-for="(item,index) in port" @click="changePort(item.id)">
                        <a href="#" data-toggle="tab">{{item.name}}</a>
                    </li>
                </ul>
            </div>
            
            <div class="col-md-6"> 
                <ul class="nav nav-tabs">
                    <li :class="{'active':index==0}" v-for="(item,index) in date" @click="changedate(index,true)">
                        <a href="javascript" data-toggle="tab">{{item.splyear+'-'+item.month}}</a>
                    </li>
                </ul>
            </div>
        </div>
    
        <div class="row">
            <div class="col-md-12">
                <table class="table table-striped table-hover ntTable" >
                    <thead>
                        <tr>
                            <th class="text-center" style="vertical-align:middle"><input type="checkbox" @click="allsel($event,'listdata')"></th>
                            <th>&nbsp;</th>
                            <th>{:strtoupper(lang('product'))}</th>
                            <th class="col-md-1">{:strtoupper(lang("box_quantity"))}</th>
                            <th>{:strtoupper(lang("quantity"))}</th>
                            <th>{:strtoupper(lang("weight"))}</th>
                            <th>{:strtoupper(lang("volume"))}</th>
                            <th>{:strtoupper(lang('amount'))}</th>
                        </tr>
                    </thead>
                    <tbody>
                        <template v-for="(item,index) in listdata.content" v-if="contentLength > 0">
                            <tr class="tr-mid">
                                <td style="vertical-align:middle" align="center"><input type="checkbox" v-model="listdata.content[index].is_che" @change="onesel($event,index,'listdata',true)"></td>
                                <td colspan="4">{{formatUnit(item.id,'id')+' / '+item.company_name+' / 交货：'+item.port_name+' / '+item.delivery_day}}</td>
                                <td colspan="3" align="right">
                                        {{formatUnit(item.CTN,'UN')}} <span class="unit">CTN</span> /
                                        {{formatUnit(item.KGS,'KG')}} <span class="unit">KGS</span> /
                                        <!-- {{item.CBM >1 ? Money(item.CBM,2) : Money(item.CBM,3)}} -->{{formatUnit(item.CBM,'M3')}} <span class="unit">CBM</span> /
                                        {{formatUnit(item.CNY,'$')}} <span class="unit">CNY</span>
                                </td>
                            </tr>
                            <tr v-for="(element,key) in item.buy_po_pack">
                                    <td style="vertical-align:middle" align="center"><input type="checkbox" v-model="listdata.content[index].buy_po_pack[key].is_che"  @change="onesel($event,index,'listdata',false)"></td>
                                    <td style="vertical-align:middle" align="center" style="width: 48px;height:48;"><img  :src="element.proinfo.img_url" border="0"></td>
                                    <td> 

                                        <template v-if="element.proinfo.pro_name">
                                            <small>{{formatUnit(element.proinfo.prochar_id,'id')
                                                +(element.proinfo.brand_name ? ' / '+element.proinfo.brand_name:'')+(element.proinfo.model ? ' / '+element.proinfo.model:'')}}</small> 
                                            <br />
                                            {{element.proinfo.pro_name}} 
                                            <br>
                                        </template>
                                        <span :style="{'line-height': element.proinfo.pro_name? '': '60px'}">{{element.note}}</span>
                                    </td>
                                    <td align="center"><input type="number" class="form-control text-right" v-model="listdata.content[index].buy_po_pack[key].qty" @input="changeVal('listdata',index,key)"></td>
                                    <td style="text-align: right;">
                                        {{element.ctn_qty}} <span class="unit">PCS/CTN</span><br>
                                        {{formatUnit(element.sum_qty,'UN')}} <span class="unit">PCS</span>
                                    </td>
                                    <td style="text-align: right;">
                                        {{formatUnit(element.ctn_kgs,'KG')}} <span class="unit">KGS/CTN</span><br>
                                        {{formatUnit(element.sum_kgs,'KG')}} <span class="unit">KGS</span>
                                    </td>
                                    <td style="text-align: right;">
                                        {{element.ctn_size}} <span class="unit">CM</span><br>
                                        <!-- {{element.ctn_m3 >1 ? Money(element.ctn_m3,2) :Money(element.ctn_m3,3)}} -->{{formatUnit(element.ctn_m3,'M3')}} <span class="unit">CBM/CTN</span> / 
                                        <!-- {{element.sum_m3 >1 ? Money(element.sum_m3,2) : Money(element.sum_m3,3)}} -->{{formatUnit(element.sum_m3,'M3')}} <span class="unit">CBM</span>
                                    </td>
                                    <td style="text-align: right;">
                                        {{formatUnit(element.price,'$')}} <span class="unit">CNY/PC</span><br>
                                        {{formatUnit(element.sum_price,'$')}} <span class="unit">CNY</span>
                                    </td>
                                </tr>
                        </template> 
                        <template v-if="contentLength == 0">
                            <tr style="text-align: center;">
                                <td colspan="8" class="no_date" style="line-height: 20rem">{:lang('no_data')} </td>
                            </tr>
                        </template>
                    </tbody>
                    <template v-if="seldata.length > 0 && listdata.content.length > 0">
                    <tfoot>
                        <tr>
                            <td colspan="2" align="center">{:strtoupper(lang('total'))}</td>
                            <td colspan="6" align="right">
                                <b>
                                {:strtoupper(lang('product'))}： {{formatUnit(listdata.footer.num,'UN')}} <span class="unit">UN</span> / 
                                {:strtoupper(lang("box_quantity"))}： {{formatUnit(listdata.footer.sum_CTN,'UN')}} <span class="unit">CTN</span> / 
                                {:strtoupper(lang("volume"))}： {{formatUnit(listdata.footer.sum_CBM,'M3')}} <span class="unit">CBM</span> / 
                                {:strtoupper(lang("weight"))}： {{formatUnit(listdata.footer.sum_KGS,'KG')}} <span class="unit">KGS</span> / 
                                {:strtoupper(lang('amount'))}： {{formatUnit(listdata.footer.sum_CNY,'$')}} <span class="unit">CNY</span>
                                </b>
                            </td>
                        </tr>
                    </tfoot>
                    </template>
                </table>
                <ul class="pagination" id="pagination">
                </ul>
            </div>
        </div>
    </div>

<!--添加弹窗部分 开始-->
<div class="modal fade" id="toContainer_editModal" tabindex="-1" role="dialog" aria-labelledby="ntModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog modal-lg" style="width:80%">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="ntModalLabel">{:strtoupper(lang('transfer_products_to_designated_container'))}</h4>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-md-12">
                        <div class="alert alert-dismissable alert-info">
                            <button type="button" class="close">×</button>
                            <p></p>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-1">指定货柜
                    </div>
                    <div class="col-md-11"> 
                        <select class="form-control" v-model="selval_">
                            <option value="0">请选择</option>
                            <option :value="item.id" v-for="(item,index) in seldata" :key="item.id" v-if="item.id != selval">{{formatUnit(item.id,'id')+' /'+item.name+' /'+item.ready_day+' /'+formatUnit(item.sum_ctn,'UN')+'CTN /'+formatUnit(item.sum_kgs,'KG')+'KGS /'+formatUnit(item.sum_cbm,'M3')+'CBM /'+formatUnit(item.sum_value,'$')+'CNY /'}}</option>
                        </select>
                    </div>
                </div>

                <div class="row">
                    <div class="col-md-12 div-scroll" style="max-height:50vh"> 
                        <table class="table table-striped table-hover ntTable" >
                            <thead>
                                <tr>
                                    <th class="text-center" style="vertical-align:middle"><input type="checkbox"  @click="allsel($event,'modellistdata')"></th>
                                    <th>&nbsp;</th>
                                    <th>{:strtoupper(lang('product'))}</th>
                                    <th class="col-md-1">{:strtoupper(lang("box_quantity"))}</th>
                                    <th>{:strtoupper(lang("quantity"))}</th>
                                    <th>{:strtoupper(lang("weight"))}</th>
                                    <th>{:strtoupper(lang("volume"))}</th>
                                    <th>{:strtoupper(lang('amount'))}</th>
                                </tr>
                            </thead>
                            <tbody>
                                <template v-for="(item,index) in modellistdata.content">
                                    <template v-if="item.isshow == 1">
                                    <tr class="tr-mid">
                                        <td style="vertical-align:middle" align="center"><input type="checkbox" v-model="modellistdata.content[index].is_che" @change="onesel($event,index,'modellistdata',true)"></td>
                                        <td colspan="4">{{formatUnit(item.id,'id') + (item.company_name ? ' / ' + item.company_name : '') + (item.port_name ? ' / 交货：' + item.port_name + ' / ' + item.delivery_day : '')}}</td>
                                        <td colspan="3" align="right">
                                                {{formatUnit(item.CTN,'UN')}} <span class="unit">CTN</span> /
                                                {{formatUnit(item.KGS,'KG')}} <span class="unit">KGS</span> /
                                                {{formatUnit(item.CBM,'M3')}} <span class="unit">CBM</span> /
                                                {{formatUnit(item.CNY,'$')}} <span class="unit">CNY</span>
                                        </td>
                                    </tr>
                                    <tr v-for="(element,key) in item.buy_po_pack" v-if="element.is_che">
                                        <td style="vertical-align:middle" align="center">
                                            <input type="checkbox" v-model="modellistdata.content[index].buy_po_pack[key].is_che"  @change="onesel($event,undefined,'modellistdata',true)"></td>
                                        <td style="vertical-align:middle" align="center">
                                            <img style="width: 48px;height:48;" :src="element.proinfo.img_url" border="0"></td>
                                        <td> 
                                            <small>{{formatUnit(element.proinfo.prochar_id,'id')+(element.proinfo.brand_name ? ' / ' + element.proinfo.brand_name :'')+(element.proinfo.model ? ' / ' + element.proinfo.model: '' )}}</small> <br />{{element.proinfo.pro_name}} </td>
                                        <td align="center"><input type="number" class="form-control text-right" v-model="modellistdata.content[index].buy_po_pack[key].qty"></td>
                                        <td>
                                            {{formatUnit(element.ctn_qty,'M')}} <span class="unit">PCS/CTN</span><br>
                                            {{formatUnit(element.sum_qty,'UN')}} <span class="unit">PCS</span>
                                        </td>
                                        <td>
                                            {{formatUnit(element.ctn_kgs,'KG')}} <span class="unit">KGS/CTN</span><br>
                                            {{formatUnit(element.sum_kgs,'KG')}} <span class="unit">KGS</span>
                                        </td>
                                        <td>
                                            {{element.ctn_size}} <span class="unit">CM</span><br>
                                            {{formatUnit(element.ctn_m3,'M3')}} <span class="unit">CBM/CTN</span> / 
                                            {{formatUnit(element.sum_m3,'M3')}} <span class="unit">CBM</span>
                                        </td>
                                        <td>
                                            {{formatUnit(element.price,'$')}} <span class="unit">CNY/PC</span><br>
                                            {{formatUnit(element.sum_price,'$')}} <span class="unit">CNY</span>
                                        </td>
                                    </tr>
                                </template>
                                </template> 
                            </tbody>
                            <tfoot>
                                <tr>
                                    <td colspan="2" align="center">{:strtoupper(lang('total'))}</td>
                                    <td colspan="6" align="right">
                                        <b>
                                            {:strtoupper(lang('product'))}： {{formatUnit(modellistdata.footer.num,'UN')}} <span class="unit">UN</span> / 
                                            {:strtoupper(lang("box_quantity"))}： {{formatUnit(modellistdata.footer.sum_CTN,'UN')}} <span class="unit">CTN</span> / 
                                            {:strtoupper(lang("volume"))}： {{formatUnit(modellistdata.footer.sum_CBM,'M3')}} <span class="unit">CBM</span> / 
                                            {:strtoupper(lang("weight"))}： {{formatUnit(modellistdata.footer.sum_KGS,'KG')}} <span class="unit">KGS</span> / 
                                            {:strtoupper(lang('amount'))}： {{formatUnit(modellistdata .footer.sum_CNY,'$')}} <span class="unit">CNY</span>
                                        </b>
                                    </td>
                                </tr>
                            </tfoot>
                        </table>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove"></span>{:strtoupper(lang('cancel'))}</button>
                <button type="button" class="btn btn-primary" @click="save('toContainer')" style="padding-left:24px;padding-right:24px"><span class="glyphicon glyphicon-floppy-disk"></span>{:strtoupper(lang('save'))}</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
</div>
<script src="/static/Admin/js/loading.js"></script>
{include file="public/foot"/}
